<template>
	<view class="detail">
		<view class="detail_list">
			<view class="list_item" v-for="(item,index) in list" :key="index">
				<view class="left">
					<text class="title">{{item.remarks}} ( {{item.coin}} )</text>
					<text class="time">{{item.add_time | ShortTime}}</text>
				</view>
				<view class="left">
					<text class="num">{{item.num}}</text>
					<text v-if="item.show_balance"
						style="font-size: 12px;color: #777;text-align: right;">{{item.balance}}</text>
				</view>
				<!-- <text class="num">{{item.num}}</text> -->
			</view>
		</view>
		<view class="cardbox" v-if="show_card">
			<image src="/static/new/cj.png" :class="show_card?'card':''" @click="getRelease" v-if="" mode="widthFix">
			</image>
		</view>
		<view class="noMore" v-if="list.length == 0">
			------- 没有更多了 -------
		</view>
	</view>
</template>

<script>
	import {
		getexchange,
	} from "@/api/user.js"
	export default {
		data() {
			return {
				list: [],
				page: 1,
				last_page: 1,
				show_card: false
			}
		},
		onReachBottom() {
			if (this.page < this.last_page) {
				this.page++
				this.getexchange()
			}
		},
		onLoad(e) {
			this.getexchange()
		},
		methods: {
			getexchange() {
				getexchange({
					page: this.page
				}).then(res => {
					let list = res.data
					if (list.data.length > 0) {
						this.list = this.list.concat(list.data)
						this.last_page = list.last_page
					} else {
						if (this.list.length == 0) {}
					}
				})
			}
		}
	}
</script>
<style lang="scss">
	page {
		background: #0F172A;
	}

	.noMore {
		padding-top: 30px;
		text-align: center;
		color: #fff;
	}

	.list_item {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 10px;
		background-color: #1E293B;
		width: 96%;
		margin: 0 auto;
		margin-top: 10px;
		box-sizing: border-box;
		border-radius: 8px;
		color: #fff;

		.list_item_box {
			width: 100%;
		}

		.left {
			display: flex;
			flex-direction: column;
			font-size: 14px;

			.title {
				color: #7989D5;
				font-weight: bold;
				font-size: 15px;
			}

			.time {
				font-weight: bold;
				font-size: 12px;
				margin-top: 8px;
			}
		}

		.num {
			font-size: 14px;
			margin-top: 5px;
			display: flex;
			justify-content: space-between;
		}

		.tips {
			font-weight: bold;
		}
	}
</style>